package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.article.util.TravelConditionUtil;
import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class TravelQuery extends QueryObject {
    private Long destId= -1L;  //目的的
    private Long tagId = -1L;  //标签
    private Long state = -1L;  //默认已发布

    private int dayType = -1;
    private int perExpendType = -1;
    private int travelTimeType = -1;
    private int orderType = 1;


    //多条件范围查询之天数

    /**
     *
     * @return new TravelConditionUtil(4,7)
     */
    public TravelConditionUtil getDayType1(){
        return TravelConditionUtil.daysMap.get(this.dayType);
    }

    public TravelConditionUtil getPerExpendType1(){
        return TravelConditionUtil.perExpendMap.get(this.perExpendType);
    }

    public TravelConditionUtil getTravelTimeType1(){
        return TravelConditionUtil.travelTimeMap.get(this.travelTimeType);
    }

    public String getOrderBy1(){
        return orderType == 1 ? "t.createTime desc" : "t.viewnum desc";
    }
}
